<template>
  <!--我的账单-->
  <span>
    <i>{{name}}</i>
  </span>
</template>
<script>
export default {
  props: {
    according: {
      // id
      type: String,
      default: ""
    },
    arrlist: {
      // 下拉数据
      type: Array,
      default: []
    }
  },
  data() {
    return {
      name: ""
    };
  },
  methods: {},
  watch: {
    according: {
      handler(newVal, oldVal) {
        if (newVal) {
          for (let item of this.arrlist) {
            if (item.id == this.according) {
              this.name = item.name;
            }
          }
        }
      },
      deep: true
    }
  },
  created() {
    for (let item of this.arrlist) {
      if (item.id == this.according) {
        this.name = item.name;
      }
    }
  },
  onShow() {
    for (let item of this.arrlist) {
      if (item.id == this.according) {
        this.name = item.name;
      }
    }
  }
};
</script>
